<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="oims.*" %>
<%@ page import="cims.*" %>
<%@ page import="order.*" %>
<% String contextPath = request.getContextPath(); %>
<%
	String number = request.getParameter("number");
	OrderRecord orec = new OrderRecord();
	List<Map<String,String>> order = orec.getInfo(number);
	Map<String,String> customer = null;
	String date = null;
	if (order != null && order.size() > 0) {
		date = order.get(0).get("date");
		String customerNumber = order.get(0).get("customer");
		CustomerRecord crec = new CustomerRecord();
		customer = crec.getInfo(customerNumber);
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="<%= contextPath %>/css/style.css" type="text/css" />
		<title>注文管理システム</title>
	</head>
	<body>
		<p>
			<table border="1" cellspacing="0">
				<caption>受注情報</caption>
				<tr>
					<td>注文番号</td>
					<td><%= number %></td>
				</tr>
				<tr>
					<td>顧客名</td>
					<td><%= customer.get("name") %></td>
				</tr>
				<tr>
					<td>受注日時</td>
					<td><%= date %></td>
				</tr>
			</table>
		</p>
		<br />
		<p>
			<table border="1" cellspacing="0">
				<caption>受注明細</caption>
				<tr>
					<td>商品番号</td>
					<td>商品名</td>
					<td>単価</td>
					<td>数量</td>
					<td>配送状況</td>
				</tr>
				<% for (Map<String,String> map : order) { %>
				<tr>
					<td><%= map.get("product") %></td>
					<td><%= OrderItem.getName(map.get("product")) %></td>
					<td align="right"><%= map.get("price") %></td>
					<td align="right"><%= map.get("quantity") %></td>
					<td><%= map.get("info") %></td>
				</tr>
				<% } %>
			</table>
		</p>
		<p>
			<a class="button" href="<%= contextPath %>/order/index.jsp">戻る</a>
		</p>
	</body>
</html>